import { createApp } from "vue";
import { createPinia } from "pinia";

import App from "./App.vue";
import router from "./router";
import ElementPlus from "element-plus"; //全局引入
import "element-plus/dist/index.css";
import "@/assets/fonts/font.css";
import "./assets/css/main.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
// import "normalize.css";



const app = createApp(App);

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}

app.use(ElementPlus);
app.use(createPinia());
app.use(router);

app.mount("#app");

const originalGetContext = HTMLCanvasElement.prototype.getContext;

HTMLCanvasElement.prototype.getContext = function (
    contextId: any,
    options?: any
): any {
    if (contextId === "2d") {
        options = options || {};
        options.willReadFrequently = true;
    }
    return originalGetContext.call(this, contextId, options);
    // 这部分改成 return HTMLCanvasElement.prototype.getContext.call(this, contextId, options) 更容易理解代码是什么意思
};
